Modification of a saved database query based on a change in the meaning of a query value over time

ABSTRACT

An apparatus and method modify a saved query based on a change in a query value meaning that changes over time. In preferred embodiments a graphical query interface displays an option to adjust query values of a saved database query. A query adjustment mechanism then adjusts the value of the query to compensate for the change in the meaning of the query value since the query was created such that the adjusted query will have the same basic meaning as when the query was originally created. Preferred Embodiments allow the user to specify to adjust the query to the current date or to a specified date in the past.

CROSS-REFERENCE TO PARENT APPLICATION

This patent application is a continuation of U.S. Ser. No. 11/366,882filed on Mar. 2, 2006, which is incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Technical Field

This invention generally relates to computer database systems, and morespecifically relates to modification of a saved query based on a changein the meaning of a query value that changes with the passage of time.

2. Background Art

Database systems have been developed that allow a computer to store alarge amount of information in a way that allows a user to search forand retrieve specific information in the database. For example, aninsurance company may have a database that includes all of its policyholders and their current account information, including paymenthistory, premium amount, policy number, policy type, exclusions tocoverage, etc. A database system allows the insurance company toretrieve the account information for a single policy holder among thethousands and perhaps millions of policy holders in its database.

Retrieval of information from a database is typically done usingqueries. A query usually specifies conditions that apply to one or morecolumns of the database, and may specify relatively complex logicaloperations on multiple columns. The database is searched for recordsthat satisfy the query, and those records that satisfy the query arereturned as the query result. A problem with using queries to retrieveinformation from a database is that it typically requires specializedknowledge of a query language, such as Structured Query Language (SQL),as well as detailed knowledge of the database and its relationships.User friendly query interfaces are being developed to provide agraphical query interface that allows a person that does not know SQL toconstruct queries to a database. For example, IBM Corporation hasdeveloped an object oriented framework known as a Data Discovery andQuery Builder (DDQB). This framework abstracts out the query layer fromthe user and lets the user build queries using a graphical interface.

Using a graphical query interface such as the DDQB, a user can constructa query to extract desired information from the database. The graphicalquery interface allows the user to store the query for later use.However, after the passage of time, some of the values used in thestored query may become outdated. So the same query run in the futuremay not present the same relative information to the user as wasintended when the query was created and saved. Parts of the query thathave a time sensitive nature are not taken into consideration for futureuse of the query.

Without a way to modify the saved query that has time sensitive queryvalues where the meaning of the query values change over time, thecomputer database industry will continue to suffer from the generationand storing of queries for future use that do not remain useful as themeaning of the values change over time.

DISCLOSURE OF INVENTION

According to the preferred embodiments, an apparatus and method modify asaved query based on a change in the meaning of a query value thatchanges over time. In preferred embodiments a graphical query interfacedisplays an option to adjust query values of a saved database query. Aquery adjustment mechanism then adjusts the value of the query tocompensate for the change in the query value since the query was createdsuch that the adjusted query will have the same basic meaning as whenthe query was originally created. Preferred embodiments allow the userto specify to adjust the query to the current date or to a specifieddate in the past.

The foregoing and other features and advantages of the invention will beapparent from the following more particular description of preferredembodiments of the invention, as illustrated in the accompanyingdrawings.

BRIEF DESCRIPTION OF DRAWINGS

The preferred embodiments of the present invention will hereinafter bedescribed in conjunction with the appended drawings, where likedesignations denote like elements, and:

FIG. 1 is a block diagram of an apparatus in accordance with thepreferred embodiments;

FIG. 2 is a display of one sample screen in a known graphical queryinterface;

FIG. 3 is a display of a sample screen in a known graphical queryinterface that is displayed in response to the user selecting the“Create a new query” link on the display in FIG. 2;

FIG. 4 is a display of a sample screen in a known graphical queryinterface that is displayed in response to the user selecting the AddCondition button in the display of FIG. 3;

FIG. 5 is a display of a sample screen in a known graphical queryinterface that is displayed in response to the user selecting theCurrentPrice button in the display of FIG. 4;

FIG. 6 is a display of a sample screen in a known graphical queryinterface that is displayed once the user has selected the “OK” buttonin the display of FIG. 5;

FIG. 7 is a display of a sample screen in a known graphical queryinterface that is displayed in response to the user adding otherconditions in a similar manner as in the display of FIG. 2 through FIG.5;

FIG. 8 is a display of a sample screen of a graphical query interfaceaccording to preferred embodiments;

FIG. 9 is a display of a sample screen of a graphical query interfaceaccording to preferred embodiments that is displayed once the user hasselected the “Time Adjust Query” button in the display of FIG. 8;

FIG. 10 is a display of a sample screen of a graphical query interfaceaccording to preferred embodiments that is displayed in response to theuser selecting the “CurrentPrice” button in FIG. 9; and

FIG. 11 is a method flow diagram for a graphical query interfaceaccording to preferred embodiments.

BEST MODE FOR CARRYING OUT THE INVENTION 1.0 Overview

The present invention relates to database queries. For those notfamiliar with databases or queries, this Overview section will providebackground information that will help to understand the presentinvention.

Known Databases and Database Queries

There are many different types of databases known in the art. The mostcommon is known as a relational database (RDB), which organizes data intables that have rows that represent individual entries or records inthe database, and columns that define what is stored in each entry orrecord.

To be useful, the data stored in databases must be able to beefficiently retrieved. The most common way to retrieve data from adatabase is to generate a database query. A database query is anexpression that is evaluated by a database manager. The expression maycontain one or more predicate expressions that are used to retrieve datafrom a database. For example, let's assume there is a database for acompany that includes a table of employees, with columns in the tablethat represent the employee's name, address, phone number, gender, andsalary. With data stored in this format, a query could be formulatedthat would retrieve the records for all female employees that have asalary greater than $40,000. Similarly, a query could be formulated thatwould retrieve the records for all employees that have a particular areacode or telephone prefix.

One popular way to define a query uses Structured Query Language (SQL).SQL defines a syntax for generating and processing queries that isindependent of the actual structure and format of the database. SQL isvery powerful for those who have detailed knowledge of SQL and who havedetailed knowledge of the database being queried. However, there are agrowing number of circumstances where people who do not have a detailedknowledge of SQL or the database need to be able to query the database.As a result, graphical query interfaces have been developed that help auser to query a database even if the user does not know SQL and does notknow the detailed relationships in the database. For example, IBMCorporation has developed an object oriented framework known as a DataDiscovery and Query Builder. This framework abstracts out the querylayer from the user and lets the user build queries using a graphicalinterface. For example, medical researchers that perform DNA mapping mayneed to access data in a very large database. A graphical queryinterface could be defined that uses the Data Discover and Query Builderframework that allows the researcher to access information in thedatabase without writing SQL queries and without understanding many ofthe relationships in the database.

Referring to FIG. 2, a display window 200 shows a graphical queryinterface for a database called StocksDatabase. We assume for thisexample that the user clicks on the “Create a new query” link. Inresponse, the display window 300 of FIG. 3 is displayed to the user.Note that no conditions have been defined for the new query, so the userclicks on the “Add Condition” button. In response, the display window400 of FIG. 4 is displayed to the user. We assume for this example thatthe user selects the CurrentPrice Array by clicking on the correspondingbutton, as shown in FIG. 4. In response, the display window 500 isdisplayed to the user, allowing the user to set a condition for theCurrentPrice. To set the condition, the user is displayed the field“CurrentPrice” 510 and allowed to set up the condition by selecting anoperator 512 and a value 514. In the illustrated example, the userselects the “<” operator, types in “80” for the value 514. After theuser then clicks on the OK button in the display window 500 of FIG. 5,the display window 600 of FIG. 6 is displayed to the user. Note that theConditions portion of the display window 600 now shows that the user hascreated the condition “Current Price<80”. We assume the user now clickson the Add Condition button, as shown in and adds further conditions tothe query to build the query as shown in FIG. 7

The query shown in FIG. 7 can be saved by the user for later use.However, the query will not necessarily have the same meaning to theuser as the literal values of the query change over time. For example,if at a later date the saved query shown in FIG. 7 is executed, but thestock price has changed significantly in comparison to the query valueof 80, then the meaning of the query as created by the user has beencompromised. The described embodiments below allow the user toautonomically adjust the query values where the meaning of those queryvalues change over time.

2.0 Description of the Preferred Embodiments

The graphical query interface in accordance with the first embodiment ofthe present invention provides a way to adjust the query values wherethe meaning of the values change over time to preserve themeaningfulness of a saved query.

Referring to FIG. 1, a computer system 100 is one suitableimplementation of an apparatus in accordance with the preferredembodiments of the invention. Computer system 100 is an IBM eServeriSeries computer system. However, those skilled in the art willappreciate that the mechanisms and apparatus of the present inventionapply equally to any computer system, regardless of whether the computersystem is a complicated multi-user computing apparatus, a single userworkstation, or an embedded control system. As shown in FIG. 1, computersystem 100 comprises a processor 110, a main memory 120, a mass storageinterface 130, a display interface 140, and a network interface 150.These system components are interconnected through the use of a systembus 160. Mass storage interface 130 is used to connect mass storagedevices, such as a direct access storage device 155, to computer system100. One specific type of direct access storage device 155 is a readableand writable CD RW drive, which may store data to and read data from aCD RW 195.

Main memory 120 in accordance with the preferred embodiments containsdata 121, an operating system 122, a database 123, and a graphical queryinterface 124. Data 121 represents any data that serves as input to oroutput from any program in computer system 100. Operating system 122 isa multitasking operating system known in the industry as i5/OS; however,those skilled in the art will appreciate that the spirit and scope ofthe present invention is not limited to any one operating system.Database 123 is any suitable database, whether currently known ordeveloped in the future. Database 123 preferably includes one or moretables. Graphical query interface 124 provides an interface that helpsthe user create and build a query that retains its value over time. Thegraphical query interface 124 includes one or more time sensitivequeries 125 that are created by a user and have one or more timeadjusted query values 126. The graphical query interface 124 alsoincludes a query adjustment mechanism 127. This mechanism helps the userto adjust the values of the time sensitive queries as described furtherbelow.

Computer system 100 utilizes well known virtual addressing mechanismsthat allow the programs of computer system 100 to behave as if they onlyhave access to a large, single storage entity instead of access tomultiple, smaller storage entities such as main memory 120 and DASDdevice 155. Therefore, while data 121, operating system 122, database123, and graphical query interface 124 are shown to reside in mainmemory 120, those skilled in the art will recognize that these items arenot necessarily all completely contained in main memory 120 at the sametime. It should also be noted that the term “memory” is used herein togenerically refer to the entire virtual memory of computer system 100,and may include the virtual memory of other computer systems coupled tocomputer system 100.

Processor 110 may be constructed from one or more microprocessors and/orintegrated circuits. Processor 110 executes program instructions storedin main memory 120. Main memory 120 stores programs and data thatprocessor 110 may access. When computer system 100 starts up, processor110 initially executes the program instructions that make up operatingsystem 122. Operating system 122 is a sophisticated program that managesthe resources of computer system 100. Some of these resources areprocessor 110, main memory 120, mass storage interface 130, displayinterface 140, network interface 150, and system bus 160.

Although computer system 100 is shown to contain only a single processorand a single system bus, those skilled in the art will appreciate thatthe present invention may be practiced using a computer system that hasmultiple processors and/or multiple buses. In addition, the interfacesthat are used in the preferred embodiment each include separate, fullyprogrammed microprocessors that are used to off-load compute-intensiveprocessing from processor 110. However, those skilled in the art willappreciate that the present invention applies equally to computersystems that simply use I/O adapters to perform similar functions.

Display interface 140 is used to directly connect one or more displays165 to computer system 100. These displays 165, which may benon-intelligent (i.e., dumb) terminals or fully programmableworkstations, are used to allow system administrators and users tocommunicate with computer system 100. Note, however, that while displayinterface 140 is provided to support communication with one or moredisplays 165, computer system 100 does not necessarily require a display165, because all needed interaction with users and other processes mayoccur via network interface 150.

Network interface 150 is used to connect other computer systems and/orworkstations (e.g., 175 in FIG. 1) to computer system 100 across anetwork 170. The present invention applies equally no matter howcomputer system 100 may be connected to other computer systems and/orworkstations, regardless of whether the network connection 170 is madeusing present-day analog and/or digital techniques or via somenetworking mechanism of the future. In addition, many different networkprotocols can be used to implement a network. These protocols arespecialized computer programs that allow computers to communicate acrossnetwork 170. TCP/IP (Transmission Control Protocol/Internet Protocol) isan example of a suitable network protocol.

At this point, it is important to note that while the present inventionhas been and will continue to be described in the context of a fullyfunctional computer system, those skilled in the art will appreciatethat the present invention is capable of being distributed as a programproduct in a variety of forms, and that the present invention appliesequally regardless of the particular type of computer-readable signalbearing media used to actually carry out the distribution. Examples ofsuitable computer-readable signal bearing media include: recordable typemedia such as floppy disks and CD RW (e.g., 195 of FIG. 1), andtransmission type media such as digital and analog communications links.Note that the preferred signal bearing media is tangible.

Referring now to FIG. 8, additional details of the graphical queryinterface 124 shown in FIG. 1 are described according to preferredembodiments. The display window 800 represents a graphical queryinterface 124 with the same query as described in the above example withreference to FIGS. 2 through 7. In this preferred embodiment, thegraphical query interface 124 further includes an option to time adjusta query. The user selects the option to time adjust a query by clickingon the time adjust query button 810 as shown. In response to the user'sselection, the graphical query interface 124 determines fields of timesensitive queries 125 (FIG. 1) that can be adjusted and displays thewindow 900 as shown in FIG. 9. Fields that have values that can beadjusted may include those query fields that have historical informationavailable in the database.

Again referring to FIG. 9, in the present example, the current price 910and the rating 920 are determined to be time sensitive values that canbe adjusted and are displayed in the window 900. For this example, theuser then selects the current price 910 as shown and the graphical queryinterface 124 then displays the window 1000 as shown in FIG. 10. Thegraphical query interface 124 allows the user to adjust the selectedquery field (CurrentPrice) to a given date 1010 or the current date1020. If the user selects the given date 1010, then the user is giventhe option to enter a date (not shown) and then the query is modifiedbased on the change in the value to the entered date. If the userselects adjust to current date 1020, then the query is modified based onthe change in the query value of the field “Current Price” as describedfurther below. In this example, the current price of the stocks in thedatabase are assumed to have changed in a significant amount such thatthe original stored query as shown no longer retains the same meaning aswhen it was created.

In preferred embodiments, when the query is modified based on the changein a query value, it is the query value that is adjusted to realize amodified query that provides a query with the same basic meaning as whenthe query was originally created. According to preferred embodiments, aquery is modified by running a query to get the historical data for thequery and comparing that historical data with the query value todetermine a time adjusted query value 126 (FIG. 1). For our example, theoriginal query is executed to gather historical data by running thequery with the date set to the time of the original query. In thisExample, the historical query would be as follows:

Select symbol, currentprice from StocksDatabase where CurrentPrice<80(Jan. 1, 2000) and rating>=4 and sector=tech

Next, a query would be executed to determine the current data for theabove query as follows:

-   -   Select symbol, currentprice from <StocksDatabase> where symbol        in (symbol list from the previous query)        The new value for the query is then determined by the product of        the original query value times the ratio of the current        data/historical data. A new query is then formulated with this        new query value by the query adjustment mechanism 127 (FIG. 1).        In this example, the original query value times the ratio of the        current data/historical data returns a query value of 62. The        new query is as follows:    -   Select symbol, currentprice from StocksDatabase where        CurrentPrice<62 (Jan. 1, 2000) and rating>=4 and sector=tech

When a query is modified according to the preferred embodiments, thechange in the query can be done with regard to other query values orwithout regard to them. In the above example, the query can be modifiedwith regard to the stock rating or not depending on the desired outcome.When the modification is done with regard to the other query values, theother query values are included in the query to gather historical datafor comparison as shown above. In contrast, when the modification isdone without regard to other query values, the other values are notincluded in the query to gather historical data for the comparison.

Referring to FIG. 11, a method 1100 in accordance with the preferredembodiments begins by displaying an option to the user to time adjustdatabase query values (step 1110). Upon selection of the option in step1110, the user is then presented with a selection of query values thatcan be adjusted (step 1120). The user then selects a database queryvalue to adjust (step 1130) from the query values in step 1120. The useris then presented with a selection of the time frame for the databasequery value to be adjusted (step 1140). The user then selects the timeframe to adjust the selected database query value (step 1150). The queryis then modified based on the change in the query value (step 1160)depending on the time frame selected in step 1150. The method 1100 isthen done.

As described above, an apparatus and method modify a saved query basedon a change in a query value that changes over time. The queryadjustment mechanism adjusts the value of the query to compensate forthe change in the query value since the query was created such that theadjusted query will have the same basic meaning as when the query wasoriginally created. In this way, the preferred embodiments overcome thestaleness of saved queries in the prior art so that generation andexecution of queries remain useful as the values of the query changeover time.

One skilled in the art will appreciate that many variations are possiblewithin the scope of the present invention. Thus, while the invention hasbeen particularly shown and described with reference to preferredembodiments thereof, it will be understood by those skilled in the artthat these and other changes in form and details may be made thereinwithout departing from the spirit and scope of the invention. Forexample, while the preferred embodiments have been shown with the queryadjustment mechanism as part of a graphical query interface, the claimedembodiments hereby expressly include those embodiments where the queryadjustment mechanism is included in other software to provide thedescribed features.

1) An apparatus comprising: at least one processor; a memory coupled tothe at least one processor; a database residing in the memory; and aquery adjustment mechanism residing in the memory and executed by the atleast one processor, the query adjustment mechanism adjusting a timesensitive query based on a change in a query value that has occurredover a period of time such that the query will have the same meaning aswhen the query was originally created and stored. 2) The apparatus ofclaim 1 wherein the query adjustment mechanism is part of a graphicalquery interface that displays an option to time adjust the timesensitive query, and in response to a user selection, adjusting the timesensitive query based on a change in a query value that has occurredover a period of time. 3) The apparatus of claim 1 wherein the query isadjusted by adjusting a query value of the time sensitive query. 4) Theapparatus of claim 3 wherein the query value is adjusted to the productof an original query value and the historical value returned by thequery divided by a current value returned by the query. 5) The apparatusof claim 1 wherein the query is done regarding other query values in thequery. 6) The apparatus of claim 1 wherein the query is donedisregarding other query values in the query. 7) The apparatus of claim1 wherein the time sensitive query is a stored query. 8) A programproduct comprising: (A) a query adjustment mechanism that adjusts a timesensitive query based on a change in a query value that has occurredover a period of time such that the query will have the same meaning aswhen the query was originally created and stored; and (B)computer-recordable signal bearing media bearing the graphical queryinterface. 9) The program product of claim 8 wherein the queryadjustment mechanism is part of a graphical query interface thatdisplays an option to time adjust a time sensitive query, and inresponse to a user selection, adjusts the time sensitive query based ona change in a query value that has occurred over a period of time. 10)The program product of claim 8 wherein the query is adjusted byadjusting a query value of the time sensitive query. 11) The programproduct of claim 10 wherein the query value is adjusted to the productof an original query value and the historical value returned by thequery divided by a current value returned by the query. 12) The programproduct of claim 8 wherein the query is done regarding other queryvalues in the query. 13) The program product of claim 8 wherein thequery is done disregarding other query values in the query. 14) Theprogram product of claim 8 wherein the time sensitive query is a storedquery.